import request from '@/utils/request'

export function claim(data) {
  return request({
    url: 'api/flowable/task/claim',
    method: 'put',
    data
  })
}

export function unclaim(data) {
  return request({
    url: 'api/flowable/task/unclaim',
    method: 'put',
    data
  })
}

export function execute(id) {
  return request({
    url: 'api/flowable/task/execute',
    method: 'put',
    params: { taskId: id }
  })
}

export function assign(data) {
  return request({
    url: 'api/flowable/task/assign',
    method: 'put',
    data
  })
}

export function delegate(data) {
  return request({
    url: 'api/flowable/task/delegate',
    method: 'put',
    data
  })
}

export function backNodes(id) {
  return request({
    url: 'api/flowable/task/backNodes',
    method: 'get',
    params: { taskId: id }
  })
}

export function back(data) {
  return request({
    url: 'api/flowable/task/back',
    method: 'put',
    data
  })
}

export function complete(data) {
  return request({
    url: 'api/flowable/task/complete',
    method: 'put',
    data
  })
}

export function stop(data) {
  return request({
    url: 'api/flowable/task/stop',
    method: 'put',
    data
  })
}

export function getDetail(id) {
  return request({
    url: 'api/flowable/task/' + id,
    method: 'get'
  })
}

export default { claim, unclaim, execute, assign, delegate, backNodes, back, complete, stop, getDetail }
